package com.blast.apply.ui

import android.content.Intent
import android.view.KeyEvent
import com.blast.apply.R
import com.blast.apply.presenter.UnApplyListPresenter
import com.wxl.common.base.AbsActivity
import com.wxl.common.life.ViewModelQuick
import kotlinx.android.synthetic.main.activity_apply_list_layout.*


/**
 * 展示已经进行过离线授权的列表
 */
class ApplyListActivity : AbsActivity(){

    override fun getCreateContentViewId(): Int {
        return R.layout.activity_apply_list_layout
    }

    override fun onCreateViewChanged() {
        applyListSmartView.isNestedScrollingEnabled = true
        applyListSmartView.setEnableRefresh(false)
        setTopTitle("离线授权列表")
        ViewModelQuick.observer(this,UnApplyListPresenter::class.java,applyListRootView)

        applyListApplyBtn.setOnClickListener {
            startActivity(Intent(this,UnderLineApplyAuthActivity::class.java))
        }

    }

    override fun onKeyDownEvent(keyCode: Int,event: KeyEvent?): Boolean {
        if(keyCode == KeyEvent.KEYCODE_F1){
            applyListLookBtn.performClick()
        } else if(keyCode == KeyEvent.KEYCODE_F4){
            applyListApplyBtn.performClick()
        } else if(keyCode == KeyEvent.KEYCODE_BACK){
            finish()
        }
        return ViewModelQuick.get(this,UnApplyListPresenter::class.java).onKeyDown(keyCode, event)
    }


    override fun addTitleSwitcher(): Boolean {
        return false
    }

}